//引入mongoose模块
const mongoose = require('mongoose');
require('./connect');

//创建学生志愿集合规则
const studentSchema = new mongoose.Schema({
    username: {
        type: String,
        ref: 'User',
        required: [true, '请传递学生姓名']
    },
    selected: {
        type: Boolean,
        default: true
    },
    titles: {
        type: [String],
    }
});

//创建集合
const Student = mongoose.model('Student', studentSchema);

//创建测试用文档
// Student.create({
//     username: 'lsc',
//     selected: false
// })

//导出集合构造函数
module.exports = {
    Student
}